package com.lw.extraceim.util;

import android.content.Context;
import android.content.DialogInterface;

import androidx.appcompat.app.AlertDialog;

/**
 * 提示框的工具类
 */
public class DialogUtil {
    //显示提示框
    public static void showDialog(Context context, String title, String message, String positiveButtonStr,
                                  String negativeButtonstr,
                                  DialogInterface.OnClickListener positiveListener,
                                  DialogInterface.OnClickListener negativeListener) {
        AlertDialog.Builder dialog = new AlertDialog.Builder(context);
        dialog.setTitle(title);
        dialog.setMessage(message);
        dialog.setPositiveButton(positiveButtonStr, positiveListener);
        dialog.setNegativeButton(negativeButtonstr, negativeListener);
        dialog.show();
    }

    /**
     * 显示提示框
     *
     * @param context
     * @param message
     */
    public static void alert(Context context, String message) {
        showDialog(context, "提示", message, "确定", null, null, null);
    }

}
